<template>
  <div class="container">
    <div class="page-tab">
      <Tab :list="tabList" v-model:value="tab"></Tab>
    </div>
    <div class="wrapper">
      <div class="wrapper-part" v-if="tab === 'index'">
        <el-scrollbar always>
          <div class="scroll-wrapper">
            <Home @changeTab="changeTab"></Home>
          </div>
        </el-scrollbar>
      </div>
      <div class="wrapper-part" v-if="tab === 'member'">
        <el-scrollbar>
          <div class="scroll-wrapper">
            <Member :addFlag="addFlag"></Member>
          </div>
        </el-scrollbar>
      </div>
      <div class="wrapper-part" v-if="tab === 'event'">
        <el-scrollbar>
          <div class="scroll-wrapper">
            <Event></Event>
          </div>
        </el-scrollbar>
      </div>
    </div>
  </div>
</template>

<script>
  import Tab from '@/components/tab'
  import Member from './member.vue'
  import Event from './event.vue'
  import Home from './home.vue'
  export default {
    name: "index",
    components: {
      Tab,
      Member,
      Home,
      Event
    },
    data() {
      return {
        addFlag: 0,
        tab: 'index',
        tabList: [
          {
            title: '首页',
            value: 'index'
          },
          {
            title: 'AI人员管理',
            value: 'member'
          },
          {
            title: 'AI事件归类',
            value: 'event'
          }
        ],
      }
    },
    methods: {
      changeTab(tab) {
        if (tab == 'memberAdd') {
          this.tab = 'member'
          setTimeout(() => {
            this.addFlag = this.addFlag + 1
          }, 0)
        } else {
          this.tab = tab
        }

      }
    }
  }
</script>

<style scoped lang="scss">
  .container{
    width: 100%;
    height: calc(100% - 60px);
    background: #181818;
    box-shadow: 12px 12px 30px 0px rgba(40,58,44,0.08);
    border-radius: 32px 32px 32px 32px;
    overflow: hidden;
    .box{
      width: 710px;
      height: 232px;
      background: linear-gradient( 24deg, #0F0F0F 0%, rgba(54,108,90,0.71) 100%);
      box-shadow: 20px 20px 30px 0px rgba(0,0,0,0.65);
      border-radius: 32px 32px 32px 32px;
      border: 1px solid;
      border-image: linear-gradient(17deg, rgba(24, 24, 24, 1), rgba(31, 210, 103, 1)) 1 1;
    }
    .page-tab{
      width: 100%;
      box-sizing: border-box;
      padding: 20px 25px;
      position: relative;
      z-index: 10;
      box-shadow: 0 15px 15px 0 rgba(#181818, 0.5);
      &:before{
        content: '';
        width: calc(100% - 50px);
        left: 25px;
        position: absolute;
        left: 25px;
        bottom: 0px;
        height: 1px;
        background: #3b3b3b;
      }
    }
    .wrapper{
      width: 100%;
      height: calc(100% - 100px);
      .wrapper-part{
        width: 100%;
        height: 100%;
        .scroll-wrapper{
          box-sizing: border-box;
          padding: 0px 40px;
        }
      }
    }
  }
</style>
